#include<iostream>
using namespace std;
int n, T;
int main()
{
	cin >> T;
	while (T--)
	{
		int n, k;
		long long a[210], b[210], c[210];
		cin >> n >> k;
		for (int i = 0;i < 2 * n;i++)
		{
			cin >> a[i];
		}
		while (k--)
		{
			for (int i = 0;i < n;i++)
			{
				b[i] = a[i];
				c[i] = a[i + n];
			}
			int d = 0, i = 0, j = 0;
			while (d < 2 * n)
			{
				if (d % 2 == 0) a[d++] = b[i++];
				else a[d++] = c[j++];
			}
		}
		for (int i = 0;i < n * 2;i++)
		{
			cout << a[i] << " ";
		}
		cout << endl;
	}
	return 0;
}